package com.daniel.model;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Calcul {
	public static Scanner sc = new Scanner(System.in);

	public static Object calculDeltha(int a,int b,int c){
		int x,y,z,d=0;
		d=(b*b)-(4*a*c);
		
		if(d==0){
			x=-b/(2*a);
			System.out.println("solution1 est ="+x+"\n");
		}else if(d>0){
			y=(int) (-b-(Math.sqrt(d)))/(2*a);
			z=(int) (-b+(Math.sqrt(d)))/(2*a);
			System.out.println("solution1 est ="+y+"\n");
			System.out.println("solution1 est ="+z);
		}else{
			System.out.print("pas de solution");
		}
		return null;		 
	}
	
	
	public static int testEntier(int f) {
		
		boolean validInput = false;
       
        while (!validInput) {
        	
            try {
                f = sc.nextInt();
                validInput = true;
            } catch (InputMismatchException e) {
                validInput = false;
                System.out.println("Veuillez entrer un entier \n");
                sc.nextLine();
            }
        }
		System.out.println(f);
		return f;
		
	}
	
	
}
